<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8"/>
    <title>amis demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1, maximum-scale=1"
    />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
    <link rel="stylesheet" href="https://bce.bdstatic.com/fex/amis-v2/sdk_fde014d.css"/>
    <style>
        html,
        body,
        .app-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
<div id="root" class="app-wrapper"></div>
<script src="https://bce.bdstatic.com/fex/amis-v2/sdk_baefd4a.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.1.0/axios.min.js"></script>
<script type="text/javascript">
    (function () {

            let amis = amisRequire('amis/embed');
            let amisScoped = amis.embed('#root', {
                "$schema": "https://baidu.gitee.io/amis/schemas/page.json#",
                "type": "page",
                "body": [
                    {
                        "filter": {
                            "controls": [
                                {
                                    "name": "name",
                                    "label": "name",
                                    "placeholder": "请输入name",
                                    "type": "text"
                                }
                            ],
                            "title": "条件搜索"
                        },
                        "filterTogglable": true,
                        "footerToolbar": [
                            "statistics",
                            "switch-per-page",
                            "pagination"
                        ],
                        "columns": [
                            {
                                "name": "domainClassName",
                                "label": "domainClassName",
                                "sortable": true,
                                "searchable": true
                            },
                            {
                                "name": "config",
                                "label": "config",
                                "sortable": true,
                                "searchable": true
                            },
                            {
                                "buttons": [
                                    {
                                        "actionType": "drawer",
                                        "drawer": {
                                            "size": "lg",
                                            "title": "修改表单",
                                            "type": "form",
                                            "body": {
                                                "controls": [
                                                    {
                                                        "name": "config",
                                                        "label": "config",
                                                        "type": "json-editor",
                                                        "size":'xxl'
                                                    }
                                                ],
                                                "api": "put:/crud-page/${domainClassName}?waitSeconds=1",
                                                "type": "form"
                                            }
                                        },
                                        "label": "修改",
                                        "type": "button"
                                    },
                                    {
                                        "label": "打开",
                                        "type": "button",
                                        "actionType": "url",
                                        "url": "/crud-helper/index.html#${domainClassName}"
                                    }
                                ],
                                "label": "操作",
                                "type": "operation"
                            }
                        ],
                        "bulkActions": [
                            {
                                "actionType": "ajax",
                                "level": "danger",
                                "confirmText": "确定要批量删除?",
                                "label": "批量删除",
                                "api": "delete:/crud-page?ids=${domainClassName|raw}",
                                "type": "button"
                            }
                        ],
                        "api": "/crud-page",
                        "type": "crud",
                        "headerToolbar": [
                            "filter-toggler",
                            "statistics",
                            "bulkActions"
                        ]
                    }
                ]
            });

    })();
</script>
</body>
</html>